import "package:flutter/material.dart";
import "package:myapp/_views/dynamic/type.dart";
// 用户身份
class UPIdentifyWidget extends StatelessWidget {
  final DynamicUPInfoAuthentication? dynamicUPInfoAuthentication;
  const UPIdentifyWidget({
    super.key,
    required this.dynamicUPInfoAuthentication,
  });
  @override
  Widget build(BuildContext context) {
    double size = 13;
    Widget child = const SizedBox();
    Color bgColor = Colors.transparent;
    if (dynamicUPInfoAuthentication != null) {
      String type = dynamicUPInfoAuthentication!.type;
      if (type == 'institution') {
        // 机构认证
        bgColor = const Color.fromARGB(255, 117, 193, 255);
        child = const Icon(
          Icons.flash_on_outlined,
          size: 8,
          color: Colors.white,
        );
      } else if (type == 'UP') {
        // up主认证
        bgColor = const Color.fromARGB(255, 255, 206, 59);
        child = const Icon(
          Icons.flash_on_outlined,
          size: 8,
          color: Colors.white,
        );
      } else {
        return const SizedBox.shrink();
      }
    } else {
      return const SizedBox.shrink();
    }
    return Container(
      height: size,
      width: size,
      decoration: BoxDecoration(
        border: Border.all(width: 1.5, color: Colors.white),
        borderRadius: BorderRadius.circular(size / 2),
        color: bgColor,
      ),
      child: Align(
        alignment: Alignment.center,
        child: child,
      ),
    );
  }
}
